/*
 * Copyright 2006 Robert Burrell Donkin
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */ 
package rat.element.visitor;

import rat.element.ArchiveElement;
import rat.element.BinaryElement;
import rat.element.Directory;
import rat.element.IElementVisitor;
import rat.element.NoteElement;
import rat.element.StandardContentElement;

public final class ElementVisitorMultiplexer implements IElementVisitor {

    private final IElementVisitor[] visitors;
    private final int length;
    
    public ElementVisitorMultiplexer(final IElementVisitor[] visitors) {
        super();
        this.visitors = visitors;
        length = visitors.length;
    }

    public void visit(Directory directory) {
        for (int i=0;i<length;i++) {
            visitors[i].visit(directory);
        }
    }

    public void visit(StandardContentElement standardContent) {
        for (int i=0;i<length;i++) {
            visitors[i].visit(standardContent);
        }
    }

    public void visit(NoteElement note) {
        for (int i=0;i<length;i++) {
            visitors[i].visit(note);
        }
    }

    public void visit(BinaryElement binary) {
        for (int i=0;i<length;i++) {
            visitors[i].visit(binary);
        }
    }

    public void visit(ArchiveElement archive) {
        for (int i=0;i<length;i++) {
            visitors[i].visit(archive);
        }
    }

}
